	var weak = [ "日", "一", "二", "三", "四", "五", "六" ];
	var months = [ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" ];
	var _doc = document;
	
	_doc.write("<div id='_Calendar_ctr' onselectstart='return false;' style='background-color:#F0F0F0;width:195px;position:absolute;display:none;border:1px solid #93C9E3;padding: 1px 1px 1px 1px;'>");
	_doc.write("<button style='width:25px' onclick='Calendar.pre_month()'>&lt;&lt;</button>");
	_doc.write("<select id='_Calendar_year'  style='width:55px' onchange='Calendar.yearChange(this)'>");
	for ( var i = 1970; i < 2170; i++) {
		_doc.write("<option value='");
		_doc.write(i);
		_doc.write("'>");
		_doc.write(i);
		_doc.write("</option>");
	}
	_doc.write("</select>");
	_doc.write("<select id='_Calendar_month'  style='width:60px'  onchange=' Calendar.monthChange(this)'>");
	
	for ( var i = 0; i < 12; i++) {
		_doc.write("<option value='");
		_doc.write(i);
		_doc.write("'>");
		_doc.write(months[i]);
		_doc.write("</option>");
	}
	_doc.write("</select>");
	_doc.write("<button style='width:25px' onclick='Calendar.next_month()'>&gt;&gt;</button>");
	_doc.write("&nbsp;&nbsp;<button style='width:20px;' onclick='Calendar.close()'>X</button>");
	_doc.write("<table width='100%'>");
	_doc.write("<tr style='background-color:#EFF2F9'>");
	
	for ( var j = 0; j < 7; j++) {
		_doc.write("<th>");
		_doc.write(weak[j]);
		_doc.write("</th>");
	}
	_doc.write("</tr>");
	var _index = 0;
	
	for ( var i = 0; i < 6; i++) {
		_doc.write("<tr>");
		for ( var j = 0; j < 7; j++) {
			_doc.write("<td  ondblclick='Calendar.dblclick(")
			_doc.write(_index);
			_doc.write(")' id='Calendar_");
			_doc.write(_index++);
			_doc.write("\''></td>");
		}
		_doc.write("</tr>");
	}
	_doc.write("</table>");
	_doc.write("<div  style='margin-top:3px;' >today:<a href='javascript:void(0)' id='_today' ondblclick='Calendar.returnVal()'></a>&nbsp;&nbsp;<a href='javascript:void(0)' id='' ondblclick='Calendar.clear()' style='font-weight:bold;color:red'>clear</a></div></div>");

var _calendar = null;

function getAbsolutePosition (el)  {
	var point = { x: el.offsetLeft, y: el.offsetTop };
	if (el.offsetParent)
	{
		var parentPoint = getAbsolutePosition(el.offsetParent);
		point.x += parentPoint.x;
		point.y += parentPoint.y;
	}
	return point;
 }

function Calendar(src,date) {
	this.src = src;
	this.date = date;
	this.dates = [];
}

Calendar.prototype.show = function() {
	var ctr=$("_Calendar_ctr");
	ctr.style.display="block";
	var point =  getAbsolutePosition(this.src);
	ctr.style.left = point.x + 'px';
	ctr.style.top  =( point.y + this.src.offsetHeight + 1) + 'px';
	Util.setSelectVal($("_Calendar_year"),this.date.getFullYear());
	Util.setSelectVal($("_Calendar_month"),this.date.getMonth());
	this.flash();
}

Calendar.pre_month = function() {
	_calendar.date.setMonth(_calendar.date.getMonth() - 1);
	_calendar.show();
}

Calendar.next_month = function() {
	_calendar.date.setMonth(_calendar.date.getMonth() + 1);
	_calendar.show();
}

Calendar.close = function() {
	var ctr=$("_Calendar_ctr");
	ctr.style.display="none";
}
Calendar.clear = function() {
	var ctr=$("_Calendar_ctr");
	ctr.style.display="none";
	_calendar.src.value= "";
}
Calendar.prototype.flash = function() {
	var td = new Date( this.date);
	td.setDate(1);
	td.setDate(td.getDate() - td.getDay());
	var index = 0;
	for ( var i = 0; i < 6; i++) {
		this.dates[index] = this.format(td)
		var text = "" + td.getDate();
		$text("Calendar_" + (index++), text.fontcolor("red"))
		td.setDate(td.getDate() + 1);
		
		for ( var j = 0; j < 5; j++) {
			this.dates[index] = this.format(td)
			$text("Calendar_" + (index++), td.getDate())
			td.setDate(td.getDate() + 1);
		}
		
		this.dates[index] = this.format(td)
		text = "" + td.getDate();
		$text("Calendar_" + (index++), text.fontcolor("red"))
		td.setDate(td.getDate() + 1);
	}
	this.today = this.format(new Date());
	var tdstr = this.today.bold();
	tdstr = tdstr.fontcolor("blue")
	$text("_today",tdstr)
}

Calendar.prototype.format = function( td) {
	var buff = [];
	var i = 0;
	buff[i++] = td.getFullYear();
	var m = (td.getMonth() + 1);
	if (m < 10) {
		m = "0" + m;
	}
	buff[i++] = "-";
	buff[i++] = m;
	m = (td.getDate());
	if (m < 10) {
		m = "0" + m;
	}
	buff[i++] = "-"
	buff[i++] = m;
	return buff.join("");
}

Calendar.parseDate = function(str) {
	var p = /\d{4}-\d{2}-\d{2}/g;
	if(p.exec(str) != null) {
		var arr = str.split("-");
		return new Date(arr[0],arr[1]-1,arr[2]);
	} else {
		throw new Error(100,"The format of date \""+ str + "\"  is Error! \n for example (2008-02-01)");
	}
}

Calendar.returnVal = function (val) {
	var ctr=$("_Calendar_ctr");
	ctr.style.display="none";
	if(!val) {
		val = _calendar.today;
	}
	_calendar.src.value= val;
}

function $text(id, text) {
	$(id).innerHTML = text;
}

 Calendar.dblclick = function(index) {
	var val = _calendar.dates[index];
	Calendar.returnVal(val);
}

 Calendar.yearChange = function (src) {
	_calendar.date.setFullYear(Util.getSelectVal(src));
	_calendar.flash();
}

 Calendar.monthChange = function(src) {
	_calendar.date.setMonth(Util.getSelectVal(src));
	_calendar.flash();
}
// 日期调用接口
function selectDate(src) {
	var d = new Date();
	if (src.value != "") {
		d = Calendar.parseDate(src.value);
	}
	_calendar = new Calendar(src,d);
	_calendar.show();
}